<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "https://github.com/rbatis/rbatis_sql/raw/main/mybatis-3-mapper.dtd">
<mapper>
    <insert id="insert">
        insert into biz_activity
        <foreach collection="arg" index="key" item="item" open="(" close=")" separator=",">
            ${key}
        </foreach>
        values
        <foreach collection="arg" index="key" item="item" open="(" close=")" separator=",">
            ${item}
        </foreach>
    </insert>
    <select id="select_by_condition">
        select * from biz_activity
        <where>
            <if test="name != ''">
                and name like #{name}
            </if>
            <if test="dt.inner() >= '2009-12-12T00:00:00'">
                and create_time < #{dt.inner()}
            </if>
            <choose>
                <when test="true">
                    and id != -1
                </when>
                <otherwise>and id != -2</otherwise>
            </choose>
            and
            <trim prefixOverrides="and">
                and name != ''
            </trim>
        </where>
    </select>

    <select id="custom_func">
        select * from biz_activity
        <where>
            <if test="name.is_test()">
                and name like #{name}
            </if>
        </where>
    </select>
</mapper>